<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>忘记密码</title>
    <link rel="shortcut icon" th:href="@{/images/favicon.ico}" />
    <link type="text/css" th:href="@{/css/css_x/findpword/css.css}" rel="stylesheet" />
    <script type="text/javascript" th:src="@{/js/PCDjs/jquery-3.2.1.js}"></script>
</head>

<body>

<div class="content">
    <div class="web-width">
        <div class="for-liucheng">
            <div class="liulist for-cur"></div>
            <div class="liulist for-cur"></div>
            <div class="liulist"></div>
            <div class="liulist"></div>
            <div class="liutextbox">
                <div class="liutext for-cur"><em>1</em><br /><strong>填写邮箱</strong></div>
                <div class="liutext for-cur"><em>2</em><br /><strong>验证身份</strong></div>
                <div class="liutext"><em>3</em><br /><strong>设置新密码</strong></div>
                <div class="liutext"><em>4</em><br /><strong>完成</strong></div>
            </div>
        </div><!--for-liucheng/-->
        <form  method="get" name="fname" class="forget-pwd">
            <dl>
                <dt>邮箱校验码：</dt>
                <dd>
                    <input type="text" name="name" />
                </dd>
                <input type="button" th:id="btn" style="margin-left: 40%;"  th:value="免费获取验证码" onclick="s(this)" />
                <div class="clears"></div>
            </dl>
            <div class="subtijiao" style="margin-top: 50px"><input type="button" value="提交" onclick="find()" /></div>
        </form><!--forget-pwd/-->
    </div><!--web-width/-->
</div><!--content/-->
<script th:inline="javascript">
    var contextPath = [[${#request.getContextPath()}]];
</script>

<script type="text/javascript" >
    function s() {
        $.ajax({
            type: "post",
            url: contextPath + "/f/t/findpwds",
            success: function () {
                var countdown = 60;
                settime();
                function settime(dates){
                    if (countdown == 0) {
                        $('#btn').attr("disabled",false);
                        $("#btn").val("免费获取验证码");
                        countdown = 60;
                    } else {
                        $('#btn').attr("disabled",true);
                        $("#btn").val("重新获取("+countdown+")");
                        countdown--;
                        setTimeout(settime,1000);
                    }
                }
            }
        })
    }
    function find() {
        var a = $("input[name='name']").val();
        $.ajax({
            type: "post",
            url: contextPath + "/f/t/finps?uname="+a,
            success: function (falg) {
                if (falg=="success"){
                    window.location.href = contextPath + "/f/t/finpth";
                }else {
                   alert("验证码错误！请重新输入！")
                }

            }
        })
    }

</script>
</body>
</html>